#include <stdio.h>

long long distanceToA[100000] = {0};
long long distanceToB[100000] = {0};

int partition(long long a[], int begin, int end)
{
	
}

void quickSort(long long a[], int n)
{
	
}

int main()
{
	long long x1 = 0, y1 = 0, x2 = 0, y2 = 0;
	scanf("%lld %lld %lld %lld", &x1, &y1, &x2, &y2);
	
	int n = 0;
	scanf("%d", &n);
	long long x = 0, y = 0;
	for ( int i = 0; i < n; i++ ) {
		scanf("%lld %lld", &x, &y);
		distanceToA[i] = (x1 - x) * (x1 - x) + (y1 - y) * (y1-y);
		distanceToB[i] = (x2 - x) * (x2 - x) + (y2 - y) * (y2-y);
	}
	
	quickSort(distanceToA, n);
	quickSort(distanceToB, n);
	
	return 0;
} 
